package main

import (
	"gomicro/microGrpc/grpcMessage"
	_ "gomicro/microGrpc/grpcServer/dao"
	"gomicro/microGrpc/grpcServer/handler"
	"log"
	"math/rand"
	"strconv"
	"github.com/micro/go-grpc"
	"github.com/micro/go-micro/v2"
	"github.com/micro/go-plugins/registry/etcdv3/v2"
)

func main() {

	grpcService := grpc.NewService(
		micro.Name("student_micro_grpc_service"),
		micro.Version("v2.5.1"),
		micro.Registry(etcdv3.NewRegistry()),
	)

	// 创建一个新的服务对象实例
	// service := micro.NewService(
	// 	micro.Name("student_micro_service"),
	// 	micro.Version("v1.18.0"),
	// 	micro.Registry(etcdv3.NewRegistry()),
	// )

	// 服务初始化
	// service.Init()
	
	grpcService.Init()

	//注册
	hs := handler.StudentHandlerCuda{
		Tag :strconv.Itoa(rand.Int()),
	}
	grpcMessage.RegisterStudentServiceHandler(grpcService.Server(), &hs)  //new(handler.StudentHandlerCuda)

	//运行
	err := grpcService.Run()
	if err != nil {
		log.Fatal(err)
	}

	
}